package com.sailfish.springbootdemo.dao.db4;

import com.sailfish.springbootdemo.common.DB4TableName;
import com.sailfish.springbootdemo.pojo.db4.User;
import com.sailfish.springbootdemo.pojo.db4.User2;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface User2Dao {
    @Select("<script>" +
            "select * from " + DB4TableName.USER +
            " <where>" +
            "<if test ='deptId != null '>" +
            " dept_id = #{deptId}" +
            "</if>" +
            "</where>" +
            "</script>")
    List<User2> getUserInfoByDept(@Param("deptId") Integer deptId);

    @Select("<script>" +
            "SELECT * FROM " + DB4TableName.USER +
            " <where>" +
            "   AND user_id IN " +
            "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>" +
            "       #{item}" +
            "   </foreach>" +
            "</where>" +
            "</script>")
    List<User2> getUserInfoByIds(@Param("ids") List<String> ids);

    @Select("<script>" +
            "SELECT * FROM " + DB4TableName.USER +
            " <where>" +
            "   AND notes_id IN " + //emp_code
            "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>" +
            "       #{item}" +
            "   </foreach>" +
            "</where>" +
            "</script>")
    List<User2> getUserInfoByCode(@Param("ids") List<String> ids);

}
